<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>类式组件</title>
    <style>
        header{
            height:100px;
            background-color: #aef;
        }
        section{
            height:500px;
            background-color: #c9f;
        }
        footer{
            height: 100px;
            background-color: #c89;
        }
    </style>
</head>
<body>
    <div id="root"></div>

    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>
    <script src="../js/babel.min.js"></script>

    <script type="text/babel">
        //类式组件
        class Top extends React.Component{
            render(){
                //返回虚拟 DOM 对象
                return <header>顶部</header>;
            }
        }

        class Content extends React.Component{
            render(){
                return <section>内容区 xxx</section>;
            }
        }

        class Bottom extends React.Component{
            render(){
                return <footer>尾部</footer>;
            }
        }

        class App extends React.Component{
            render(){
                return <div>
                    <Top />
                    <Content /> 
                    <Bottom />
                </div>
            }
        }
        
        //渲染
        ReactDOM.render(<App />, document.querySelector("#root"));
    </script>
</body>
</html>